blob: b8e75a204c540da8852f2d650687600f4d9a1b68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
---
import { getCollection, type CollectionEntry } from "astro:content";
import Layout from "@/layouts/main.astro";
import { buttonVariants } from "@/components/ui/button";
import PostHeader from "@/components/PostHeader.astro";
import OpenRing from "@/components/OpenRing.astro";
export async function getStaticPaths() {
const posts = await getCollection("blog");
return posts.map((post) => ({
params: { slug: post.id },
props: { post },
}));
}
interface Props {
post: CollectionEntry<"blog">;
}
const { post } = Astro.props as Props;
const { Content } = await post.render();
---
<Layout title={`${post.data.title} | Iwan Ingman's Blog`} description={post.data.description}>
<main class="mx-auto flex w-full max-w-3xl flex-col gap-8 p-4 md:p-6">
<PostHeader
title={post.data.title}
slug={post.id}
description={post.data.description}
author={post.data.author}
publishDate={post.data.publishDate}
/>
<article class="space-y-4 leading-relaxed">
<Content />
</article>
<div>
<a class={buttonVariants({ size: "xs", variant: "outline" })} href="/">Back to posts</a>
</div>
<OpenRing />
</main>
</Layout>
|